package com.ziyucoding.springboot.labs.lab10.seatdemo.atmd.dao;

import com.ziyucoding.springboot.labs.lab10.seatdemo.atmd.dataobject.OrderDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

/**
 * 订单 DAO
 *
 * @author ziyucoding
 * @date 2022-11-02
 **/
@Mapper
@Repository
public interface OrderDao {
    /**
     * 保存订单
     *
     * @param order
     * @return
     */
    @Insert("INSERT INTO orders (user_id, product_id, pay_amount) VALUES (#{userId}, #{productId}, #{payAmount})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    int saveOrder(OrderDO order);
}
